Skip to content

Use the internal pretty-printer consistently - #14904

Open
Parzival235 wants to merge 3 commits into
pytest-dev:mainfrom
Parzival235:agent/use-internal-pprint
Open

Use the internal pretty-printer consistently#14904
Parzival235 wants to merge 3 commits into
pytest-dev:mainfrom
Parzival235:agent/use-internal-pprint

Conversation

@Parzival235

Copy link
Copy Markdown

Closes #14859.

Summary

  • replace the remaining stdlib "pformat" call sites with pytest's internal "PrettyPrinter"
  • use "pformat_lines" for line-oriented output, including the existing truncation budgets for mapping diffs
  • keep mapping summaries deterministically sorted while formatting nested values in pytest's expanded style
  • add regression coverage and update assertion-output snapshots for the expanded representation

This makes nested output consistent across supported Python versions instead of changing only on Python 3.15+.

Validation

  • 523 focused tests passed
  • all pre-commit hooks passed, including Ruff, mypy, codespell, and changelog checks

AI-assisted contribution

This implementation was prepared with OpenAI Codex. I reviewed the behavior and diff, understand the output and truncation changes, and take responsibility for maintaining the contribution and responding substantively to review feedback.

@psf-chronographer psf-chronographer Bot added the bot:chronographer:provided (automation) changelog entry is part of PR label Aug 18, 2026
@Parzival235
Parzival235 marked this pull request as ready for review August 18, 2026 16:57
@Parzival235
Parzival235 marked this pull request as draft August 18, 2026 16:57
Comment thread src/_pytest/assertion/_compare_mapping.py Outdated
@Parzival235
Parzival235 marked this pull request as ready for review August 19, 2026 03:16
@RonnyPfannschmidt

Copy link
Copy Markdown
Member

this pr is not following the ai policies

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bot:chronographer:provided (automation) changelog entry is part of PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

use expand=True for pformat(...) in python 3.15+

3 participants